//
//  Common.h
//  TAOVideo
//
//  Created by Lin Eidan on 13-8-6.
//  Copyright (c) 2013年 taomee. All rights reserved.
//

#import <Foundation/Foundation.h>


@interface Common : NSObject


//角度转弧度
+(CGFloat)degreesToRadians:(CGFloat )degrees;

//弧度转角度
+(CGFloat)radiansToDegrees:(CGFloat )radians;

+(NSString *)md5:(NSString *)str;

//获得一个随机的电话号码。
+(NSString *)getARadomPhoneNum;

+(BOOL)checkPhoneLegal:(NSString *)phone;

+(NSString *)getARadomQQNum;

//不管是否设置了静音，播放器都会有声音，无视静音键。
+(void)handleAlwaysSoundIgnoreMuteSwitch;


//系统相关
+ (NSString *)getAppBundleId;

+ (NSString *)getOSVersion;              //获取IOS系统的版本号

+ (NSString *)getOpenUDID;            //获取设备UUID

+ (NSString *)getAppVersion;             //获取该应用版本号

+ (NSString *)getAppBuild;               //获取该应用build 号

+ (NSString *)getAppVersionInfo;         //1.02(build_20130123.1123)

+ (BOOL)isIPad;

+(NSString *)getAppStoreURL;
+(void)goToAppStore;

//系统相关 end

//获取一个随机整数，范围在[from,to]，包括from，包括to
+(int)getRandomNumber:(int)from to:(int)to;

+ (UIImage *)createImageWithColor:(UIColor *)color;

+ (UIImage *)createImageWithColor:(UIColor *)color andSize:(CGSize )size;

+ (NSString *)convertStringToUTF8:(NSString *)str;

//去除两端空格
+(NSString *)removeCharacterSpace:(NSString *)str;

+(NSString *)getFolderOfTheFile:(NSString *)pathString;

+(NSString *)getTrueDocName:(NSURL *)path;

//获取一个带“／”的字符串，“／”后面的字符串
+(NSString *)getLastStringFromSlash:(NSString *)pathString;

//处理时间变成00:00:00格式
+(NSString *)handleTheTime:(float )interval;

//去除两端空格和回车
+(NSString *)removeCharacterSpaceAndEnter:(NSString *)str;

+(void)putTheView:(UIView *)view inHorizontalCenterOfParentView:(UIView *)parentView;

+(void)handleHeightWithIPhone5WithView:(UIView *)view;

+(void)handleWidthWithIPhone5WithView:(UIView *)view;

+(void)networkActivityIndicatorDisplay:(BOOL)isDisplay;

//ios6下，位置还取决于状态栏是否隐藏，状态栏显示的话 ，就要－20.
+(void)handleTheViewTopDependOnStatusBarInIOS6:(UIView *)view;

+(void)handleRightSizeWithPadLandscapeAndPhonePortraitWithView:(UIView *)view;

+(void)handleView:(UIView *)view withFrame:(CGRect )frame andTransform:(CGAffineTransform)transform;

+(void)handleStatusBarTo:(UIInterfaceOrientation)orientation withAnimation:(BOOL)isAnimation;

+(void)handleStatusBarTo:(UIInterfaceOrientation)orientation;

+(UIInterfaceOrientation)getCurrentStatusBarOri;


//控制状态栏的背景色，这句话一般用在根视图，其他视图都是在其基础上添加，减少代码量，如果是tabbar，也最好用一个根视图控制,要注意是否被遮盖。。也可以在delegate中对window直接添加,如果需要旋转屏幕的话，就需要对返回的这个背景进行处理。。
+(UIView *)handleTheStateBarWithBackgroundColor:(UIColor *)color andAlpha:(float) alpha InTheView:(UIView *)parentView;

+(void)handleTheStatusBarDislay:(BOOL )isDislay;

+ (void)forcedTheView:(UIView *)view toTheOrientaion:(UIInterfaceOrientation)orientation;

+(void)pushViewWithAnimation:(UIView *)view withParentView:(UIView *)parentView;

+(void)popViewWithAnimation:(UIView *)view;


//画控间
+(UILabel *)createLabelWithFrame:(CGRect )frame andText:(NSString *)text andTextColor:(UIColor *)color andFontSize:(int )fontSize andTextAlignment:(NSTextAlignment )textAlignment;

//根据字符串的多少，对特定label的宽度，进行适配，让label的高度刚刚好。
+(float)handleTheLabelHeight:(UILabel *)label withText:(NSString *)str withMaxHeight:(float )maxHeight;

+(float)handleTheLabelWidth:(UILabel *)label withText:(NSString *)str;

+(float)handleTheLabelHeight:(UILabel *)label withText:(NSString *)str;

//获得今天日期的具体信息。
+ (NSDateComponents *)getDateDetailInfo;

//获得今天几号。
+ (int )getTodayDate;

+ (int )getTodayWeekDay;


//scrollView 跳到正确位置。
+(float )handleTheOffsetY:(float) offset toRightInScrollView:(UIScrollView *)scrollView;
+(float )handleTheOffsetX:(float) offset toRightInScrollView:(UIScrollView *)scrollView;

//让一个在scrollView视图中的view，一开始跟着滑动，然后他快要消失的时候就顶着scrollView的边，不消失，然后回退的时候，他又回到原来的位置，类似tableView的每个section的headerView的效果。
//defaultY是一个全局变量。
+(void)handleView:(UIView *)subView andThisViewDefaultY:(float)defaultY InScrollViewAlwaysCanSee:(UIScrollView *)scrollView;

//让tableview的组视图跟着滑
+(void)tableHeaderScrollWithScrollView:(UIScrollView*)scrollView andWithHeaderHeight:(CGFloat)height;

//加一分
+(void)addScoreWithParentView:(UIView*)parentView;

//检测越狱
+(BOOL)isJailBreak;
+(BOOL)isJailBroken;

//定期拉接口
+(BOOL)todayNeedToNewDataOrNotForKey:(NSString *)dataKey everyFewDays:(int )day;
+(void)todayHasGetNewDataForKey:(NSString *)dataKey;

//获取上一次最大的系统消息的id
+(NSString*)getMaxMesgId;

//添加小红点
+(void)addRedCircleForView:(UIView*)mView andPosition:(CGRect)position andCounts:(int)nums;

#pragma mark - 点击获得文耀
+(void)getWYByPostWithType:(NSString *)type andItemId:(NSString *)ItemId;

@end
